3.505 \(\int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n} \, dx\)

Optimal. Leaf size=92 \[ \frac {2 i a^2 (a+i a \tan (e+f x))^{-n} (d \sec (e+f x))^{2 n}}{f n (n+1)}+\frac {i a (a+i a \tan (e+f x))^{1-n} (d \sec (e+f x))^{2 n}}{f (n+1)} \]

[Out]

I*a*(d*sec(f*x+e))^(2*n)*(a+I*a*tan(f*x+e))^(1-n)/f/(1+n)+2*I*a^2*(d*sec(f*x+e))^(2*n)/f/n/(1+n)/((a+I*a*tan(f
*x+e))^n)

________________________________________________________________________________________

Rubi [A]  time = 0.13, antiderivative size = 92, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.062, Rules used = {3494, 3493} \[ \frac {2 i a^2 (a+i a \tan (e+f x))^{-n} (d \sec (e+f x))^{2 n}}{f n (n+1)}+\frac {i a (a+i a \tan (e+f x))^{1-n} (d \sec (e+f x))^{2 n}}{f (n+1)} \]

Antiderivative was successfully verified.

[In]

Int[(d*Sec[e + f*x])^(2*n)*(a + I*a*Tan[e + f*x])^(2 - n),x]

[Out]

(I*a*(d*Sec[e + f*x])^(2*n)*(a + I*a*Tan[e + f*x])^(1 - n))/(f*(1 + n)) + ((2*I)*a^2*(d*Sec[e + f*x])^(2*n))/(
f*n*(1 + n)*(a + I*a*Tan[e + f*x])^n)

Rule 3493

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(2*b*
(d*Sec[e + f*x])^m*(a + b*Tan[e + f*x])^(n - 1))/(f*m), x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 + b^2
, 0] && EqQ[Simplify[m/2 + n - 1], 0]

Rule 3494

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(d
*Sec[e + f*x])^m*(a + b*Tan[e + f*x])^(n - 1))/(f*(m + n - 1)), x] + Dist[(a*(m + 2*n - 2))/(m + n - 1), Int[(
d*Sec[e + f*x])^m*(a + b*Tan[e + f*x])^(n - 1), x], x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 + b^2, 0]
 && IGtQ[Simplify[m/2 + n - 1], 0] &&  !IntegerQ[n]

Rubi steps

\begin {align*} \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{2-n} \, dx &=\frac {i a (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{1-n}}{f (1+n)}+\frac {(2 a) \int (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{1-n} \, dx}{1+n}\\ &=\frac {i a (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{1-n}}{f (1+n)}+\frac {2 i a^2 (d \sec (e+f x))^{2 n} (a+i a \tan (e+f x))^{-n}}{f n (1+n)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 1.17, size = 61, normalized size = 0.66 \[ -\frac {a^2 (n \tan (e+f x)-i (n+2)) (a+i a \tan (e+f x))^{-n} (d \sec (e+f x))^{2 n}}{f n (n+1)} \]

Antiderivative was successfully verified.

[In]

Integrate[(d*Sec[e + f*x])^(2*n)*(a + I*a*Tan[e + f*x])^(2 - n),x]

[Out]

-((a^2*(d*Sec[e + f*x])^(2*n)*((-I)*(2 + n) + n*Tan[e + f*x]))/(f*n*(1 + n)*(a + I*a*Tan[e + f*x])^n))

________________________________________________________________________________________

fricas [A]  time = 0.97, size = 139, normalized size = 1.51 \[ \frac {{\left ({\left (i \, n + i\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + {\left (i \, n + 2 i\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i\right )} \left (\frac {2 \, d e^{\left (i \, f x + i \, e\right )}}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{2 \, n} e^{\left (-i \, e n + {\left (-i \, f n + 2 i \, f\right )} x - 4 i \, f x - {\left (n - 2\right )} \log \left (\frac {2 \, d e^{\left (i \, f x + i \, e\right )}}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right ) - {\left (n - 2\right )} \log \left (\frac {a}{d}\right ) - 2 i \, e\right )}}{2 \, {\left (f n^{2} + f n\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*sec(f*x+e))^(2*n)*(a+I*a*tan(f*x+e))^(2-n),x, algorithm="fricas")

[Out]

1/2*((I*n + I)*e^(4*I*f*x + 4*I*e) + (I*n + 2*I)*e^(2*I*f*x + 2*I*e) + I)*(2*d*e^(I*f*x + I*e)/(e^(2*I*f*x + 2
*I*e) + 1))^(2*n)*e^(-I*e*n + (-I*f*n + 2*I*f)*x - 4*I*f*x - (n - 2)*log(2*d*e^(I*f*x + I*e)/(e^(2*I*f*x + 2*I
*e) + 1)) - (n - 2)*log(a/d) - 2*I*e)/(f*n^2 + f*n)

________________________________________________________________________________________

giac [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (d \sec \left (f x + e\right )\right )^{2 \, n} {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{-n + 2}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*sec(f*x+e))^(2*n)*(a+I*a*tan(f*x+e))^(2-n),x, algorithm="giac")

[Out]

integrate((d*sec(f*x + e))^(2*n)*(I*a*tan(f*x + e) + a)^(-n + 2), x)

________________________________________________________________________________________

maple [F]  time = 3.62, size = 0, normalized size = 0.00 \[ \int \left (d \sec \left (f x +e \right )\right )^{2 n} \left (a +i a \tan \left (f x +e \right )\right )^{2-n}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*sec(f*x+e))^(2*n)*(a+I*a*tan(f*x+e))^(2-n),x)

[Out]

int((d*sec(f*x+e))^(2*n)*(a+I*a*tan(f*x+e))^(2-n),x)

________________________________________________________________________________________

maxima [B]  time = 0.68, size = 304, normalized size = 3.30 \[ \frac {2^{n + 1} a^{2} d^{2 \, n} \cos \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) - i \cdot 2^{n + 1} a^{2} d^{2 \, n} \sin \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) + 2 \, {\left (a^{2} d^{2 \, n} n + a^{2} d^{2 \, n}\right )} 2^{n} \cos \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) - {\left (2 i \, a^{2} d^{2 \, n} n + 2 i \, a^{2} d^{2 \, n}\right )} 2^{n} \sin \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right )}{{\left (-i \, a^{n} n^{2} - i \, a^{n} n + {\left (-i \, a^{n} n^{2} - i \, a^{n} n\right )} \cos \left (2 \, f x + 2 \, e\right ) + {\left (a^{n} n^{2} + a^{n} n\right )} \sin \left (2 \, f x + 2 \, e\right )\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n} f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*sec(f*x+e))^(2*n)*(a+I*a*tan(f*x+e))^(2-n),x, algorithm="maxima")

[Out]

(2^(n + 1)*a^2*d^(2*n)*cos(n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) - I*2^(n + 1)*a^2*d^(2*n)*sin(n*
arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) + 2*(a^2*d^(2*n)*n + a^2*d^(2*n))*2^n*cos(-2*f*x + n*arctan2(
sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 2*e) - (2*I*a^2*d^(2*n)*n + 2*I*a^2*d^(2*n))*2^n*sin(-2*f*x + n*arct
an2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 2*e))/((-I*a^n*n^2 - I*a^n*n + (-I*a^n*n^2 - I*a^n*n)*cos(2*f*x
+ 2*e) + (a^n*n^2 + a^n*n)*sin(2*f*x + 2*e))*(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1
)^(1/2*n)*f)

________________________________________________________________________________________

mupad [B]  time = 7.82, size = 260, normalized size = 2.83 \[ -{\mathrm {e}}^{-e\,4{}\mathrm {i}-f\,x\,4{}\mathrm {i}}\,{\left (\frac {d}{\frac {{\mathrm {e}}^{-e\,1{}\mathrm {i}-f\,x\,1{}\mathrm {i}}}{2}+\frac {{\mathrm {e}}^{e\,1{}\mathrm {i}+f\,x\,1{}\mathrm {i}}}{2}}\right )}^{2\,n}\,\left (\frac {{\left (a-\frac {a\,\left ({\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,1{}\mathrm {i}-\mathrm {i}\right )\,1{}\mathrm {i}}{{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}+1}\right )}^{2-n}}{2\,f\,n\,\left (n\,1{}\mathrm {i}+1{}\mathrm {i}\right )}+\frac {{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,{\left (a-\frac {a\,\left ({\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,1{}\mathrm {i}-\mathrm {i}\right )\,1{}\mathrm {i}}{{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}+1}\right )}^{2-n}\,\left (n+2\right )}{2\,f\,n\,\left (n\,1{}\mathrm {i}+1{}\mathrm {i}\right )}+\frac {{\mathrm {e}}^{e\,4{}\mathrm {i}+f\,x\,4{}\mathrm {i}}\,{\left (a-\frac {a\,\left ({\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,1{}\mathrm {i}-\mathrm {i}\right )\,1{}\mathrm {i}}{{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}+1}\right )}^{2-n}\,\left (n+1\right )}{2\,f\,n\,\left (n\,1{}\mathrm {i}+1{}\mathrm {i}\right )}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d/cos(e + f*x))^(2*n)*(a + a*tan(e + f*x)*1i)^(2 - n),x)

[Out]

-exp(- e*4i - f*x*4i)*(d/(exp(- e*1i - f*x*1i)/2 + exp(e*1i + f*x*1i)/2))^(2*n)*((a - (a*(exp(e*2i + f*x*2i)*1
i - 1i)*1i)/(exp(e*2i + f*x*2i) + 1))^(2 - n)/(2*f*n*(n*1i + 1i)) + (exp(e*2i + f*x*2i)*(a - (a*(exp(e*2i + f*
x*2i)*1i - 1i)*1i)/(exp(e*2i + f*x*2i) + 1))^(2 - n)*(n + 2))/(2*f*n*(n*1i + 1i)) + (exp(e*4i + f*x*4i)*(a - (
a*(exp(e*2i + f*x*2i)*1i - 1i)*1i)/(exp(e*2i + f*x*2i) + 1))^(2 - n)*(n + 1))/(2*f*n*(n*1i + 1i)))

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (d \sec {\left (e + f x \right )}\right )^{2 n} \left (i a \left (\tan {\left (e + f x \right )} - i\right )\right )^{2 - n}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*sec(f*x+e))**(2*n)*(a+I*a*tan(f*x+e))**(2-n),x)

[Out]

Integral((d*sec(e + f*x))**(2*n)*(I*a*(tan(e + f*x) - I))**(2 - n), x)

________________________________________________________________________________________